#ifndef PHYSICS_DISC_H
#define PHYSICS_DISC_H

//;)

#include "Collidable.h"
#include "../Math/Vector.h"

using namespace Math;

namespace Physics
{
	class Disc: public Collidable
	{
		public:
				Disc(float radius=0);

				/**********
				* GETTERS *
				**********/
				float radius() const;
				const Point& center() const;

				/**********
				* SETTERS *
				**********/
				void setRadius(float radius);
				void setCenter(const Point& center);

				/************
				* COLLISION *
				************/
				//Does d1 collide with d2?
				friend float operator% (const Disc& d1, const Disc& d2)
				{
					//The vector described by the two points
					//Math::Vector v(d2.center(),d1.center());
					float dx=d2.center().x()-d1.center().x();
					float dy=d2.center().y()-d1.center().y();
					float dz=d2.center().z()-d1.center().z();
					float vlength_squared=dx*dx+dy*dy+dz*dz;

					float radii_sum=d1.radius()+d2.radius();

					float amount=radii_sum*radii_sum-vlength_squared;

					if (amount>0)
						return amount;

					return 0.0f;
				}

		protected:
				float _radius;
				Point _center;
	};
}

#endif
